package com.acme.testing.assertions;

public class Assert {
	
	public static void fail(String message) {
		throw new AssertionException(message);
	}
	
	public static void assertEquals(String message, Object expected, Object actual) {
		if (!actual.equals(expected)) {
			fail(message + " got : " + actual + " expected : " + expected);
		}
	}
	
	public static void assertEquals(Object expected, Object actual) {
		assertEquals("", expected, actual);
	}

	public static void assertEqualsDelta(String message, double expected, double actual, double delta) {
		if (Math.abs(actual - expected) > delta) {
			fail(message + " got : " + actual + " expected : " + expected);
		}
	}
	
	public static void assertEqualsDelta(double expected, double actual, double delta) {
		assertEqualsDelta("", expected, actual, delta);
	}
	
	public static void assertNull(String message, Object arg) {
		if (arg != null) {
			fail(message);
		}
	}
}
